package net.lab1024.sa.admin.module.open.result;

import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.admin.module.open.result.domain.ResultInfoForm;
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
public class ExecuteResultController {

    private final ExecuteResultService executeResultService;

    public ExecuteResultController(ExecuteResultService executeResultService) {
        this.executeResultService = executeResultService;
    }

    @NoNeedLogin
    @PostMapping("/deployResult")
    public ResponseDTO<String> deployResult(@RequestBody ResultInfoForm form) {
        log.info(JSON.toJSONString(form));
        executeResultService.deployResult(form);
        return ResponseDTO.ok();
    }
}
